import { NgModule, Inject } from '@angular/core';
import { SharedModule } from '@shared';
import { ALAIN_I18N_TOKEN } from '@delon/theme';
import { I18NService } from '@core';
import { default as zh_CN } from './_i18n/zh-CN';
import { default as en_US } from './_i18n/en-US';
import { AdminRoutingModule } from './admin-routing.module';
import { AdminLayoutComponent } from './_layout/layout.component';
import { RoleBasicComponent } from './role/role-basic.component';
import { RoleModalComponent } from './role/edit/role-modal.component';
import { MenuAuthModalComponent } from './role/auth/menu-auth-modal.component';
import { DeptmentBasicComponent } from './deptment/deptment-basic.component';
import { MenuBasicComponent } from './menu/menu-basic.component';
import { PermissionModalComponent } from './menu/edit/permission-modal.component';
import { UserListComponent } from './user/user-list.component';
import { RoleViewComponent } from './user/role-view-group/role-view-group.component';
import { UserInfoModalComponent } from './user/edit/user-modal.component';

const COMPONENTS = [
  AdminLayoutComponent,
  RoleBasicComponent,
  DeptmentBasicComponent,
  MenuBasicComponent,
  UserListComponent,
];
const COMPONENTS_NOROUNT = [
  RoleModalComponent,
  MenuAuthModalComponent,
  PermissionModalComponent,
  RoleViewComponent,
  UserInfoModalComponent,
];

@NgModule({
  imports: [SharedModule, AdminRoutingModule],
  declarations: [...COMPONENTS, ...COMPONENTS_NOROUNT],
  entryComponents: COMPONENTS_NOROUNT,
})
export class AdminModule {
  constructor(@Inject(ALAIN_I18N_TOKEN) i18n: I18NService) {
    i18n.load('zh-CN', zh_CN);
    i18n.load('en-US', en_US);
  }
}
